﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using Snowdreamist.ComponentModel.Plugin;
using Snowdreamist.Threading;
using Snowdreamist.Windows.Notification;
using SNSpirit.Service.Notification;

namespace SNSpirit.Views.Notification
{
    public class NotificationContainer : ContentControl
    {
        static NotificationContainer()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(NotificationContainer), new FrameworkPropertyMetadata(typeof(NotificationContainer)));
        }

        public NotificationContainer()
        {
            // hook notification
            BackgroundJob.Run(new Action(this.HandleBackgroundNotification), "Notification Consumer Waiting Job for Scope: Background");
            BackgroundJob.Run(new Action(this.HandleApplicationNotification), "Notification Consumer Waiting Job for Scope: Application");
        }

        protected virtual void HandleBackgroundNotification()
        {
            foreach (var job in SNSpirit.Service.Notification.NotificationService.Current.WaitNotifications(NotificationScope.Background))
            {
            }
        }

        protected virtual void HandleApplicationNotification()
        {
            foreach (var job in SNSpirit.Service.Notification.NotificationService.Current.WaitNotifications(NotificationScope.Application))
            {
            }
        }
    }
}